<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

	 function __construct() 
	 {
	 	parent::__construct();
        $this->load->model('ganado');

	}

	public function index()
	{
		$consultaGanado = $this->ganado->get_inv_ganado();
		

		if ($consultaGanado->result() > 0) 
		{
			$response["ganado"] = array();

			foreach ($consultaGanado->result() as $valor) 
			{
				$ganaderia['id'] = $valor->idinventario_ganado; 
				$ganaderia['codigo'] = $valor->cod_ganado; 
				$ganaderia['codigo']= $valor->color;

				array_push($response["ganado"], $ganaderia);
			}
			$data['movil']= 'ganado_movil';
			$response["success"] = 1;
			$data['json']= $response; 
		}else {
	    // no products found
	    $response["success"] = 0;
	    $response["message"] = "Sin producto";
		}	
	    // echo no users JSON
	    $data['json']=$response;

		$this->load->view('welcome_message', $data);
	}

	private function consulta_ganado()
	{
		return $this->ganado->get_inv_ganado();
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */